package com.orhon.smartcampus.modules.systemctl.inputMapper;

import java.util.List;
import java.util.Map;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.factory.Mappers;

import com.alibaba.fastjson.JSON;
import com.orhon.smartcampus.basicComponents.ConvertHelper;
import com.orhon.smartcampus.modules.systemctl.gqlInputModel.GQLMenusInput;

@Mapper(uses = {
        ConvertHelper.class
})
public interface MenusInputMapper {


    MenusInputMapper MAPPER = Mappers.getMapper(MenusInputMapper.class);

//    @Mapping(source = "clients" , target = "clients",qualifiedByName = "list2json")
    default GQLMenusInput mapInput(final Map map){
        String json = JSON.toJSONString(map);
        GQLMenusInput input = JSON.parseObject(json , GQLMenusInput.class);
        return input;
    }
//    @Named("list2json")
//    default String list2json (List<Long> list){
//        return JSON.toJSONString(list);
//    }
}
